<div class="main_box"> 
	<div id="mainContent_2"> 
		<div id="coupon-items">
			<div class="submenubg"></div>
			<div class="switch_menu">
				<ul>	


				<?php
					if($type===0)
					{
				
				?>	<li class="tab_current" id="t1"><span class="spancolor1">免费优惠卷</span></li>
					<a class="ta" href="<?php echo edp_href_link(PAGENAME_COUPON_SUMMARY, 'type=1');?>"><li class="tab_show" id="t2"><span class="spancolor">付费优惠卷</span></li></a>						                                                  
				
				
				<?php
					} else{
				?>
					<a class="ta" href="<?php echo edp_href_link(PAGENAME_COUPON_SUMMARY, 'type=0');?>"><li class="tab_show" id="t1"><span class="spancolor">免费优惠卷</span></li></a>
					<li class="tab_current" id="t2"><span class="spancolor2">付费优惠卷</span></li>			                                   
				
				<?php
					}
				?>	

			                
			 	</ul>
			</div>
			<div class="bar"></div>
        	<div class="box" id="alb1">
<?php
				if($coupons)
				{
					$printN = 1;
					foreach($coupons as $key=>$coupon)
					{
						if( $printN % 3 == 1 ) 
					 	{
?>
							<div class="clear hack bdbottom">
<?php 
					 	}
?>
						 <div class="coupon">
						 	<div class="iconbg_free">
						  	 <a class="pos" href="<?php echo edp_href_link(PAGENAME_COUPON_INFO, 'couponID='.$coupon['coupon_id']);?>">
						 	
						 		<img src="<?php echo EdpGetCouponPicUrl($coupon['coupon_picture']);?>" width="150"  />
						 	</a>
						 	
						 	</div>
						 	<h5>
						 		<a href="<?php echo edp_href_link(PAGENAME_COUPON_INFO, 'couponID='.$coupon['coupon_id']);?>">
						 		<?php echo $coupon['coupon_name'];?>
						 		</a>
						 	</h5>
<?php
							$types=explode(",",$coupon['coupon_type']);
							if(in_array("1", $types))
							{
								echo '<p>有效期：'.EdpSubStr($coupon['coupon_start_date'],0,10).'至'.EdpSubStr($coupon['coupon_end_date'],0,10).'</p>';
							}
							else
							{
								echo '<p>有效期：不限期</p>';
							}
							if(in_array("2", $types))
							{
								echo '<p>剩余数目：'.$coupon['coupon_total_num'].'</p>';
							}
							else
							{
								echo '<p>剩余数目：不限量</p>';
							}
							if($type!=0)
							{
?>
								<p>交易价格：<?php echo $coupon['coupon_per_price'];?>个E币 </p>
<?php
							}
?>   				
            			</div>
<?php
						if($printN % 3 === 0)
						{
							echo '</div>';
						}
						$printN++;
					}
					if( $printN % 3 !== 1 )
					{
						echo '</div>';
					}
				} 	
				echo $pageObj->getBar(); 
				echo '</div>';
?>


        	<div class="box" id="alb2" style="display: none;">
<?php
				if($coupons)
				{
					$printN = 1;
					foreach($coupons as $key=>$coupon)
					{
						if( $printN % 3 == 1 ) 
					 	{
?>
							<div class="clear hack bdbottom">
<?php 
					 	}
?>
						 <div class="coupon">
						 	<div class="iconbg_free">
						 	<a class="pos" href="<?php echo edp_href_link(PAGENAME_COUPON_INFO, 'couponID='.$coupon['coupon_id']);?>">
						 	
						 		<img src="<?php echo EdpGetCouponPicUrl($coupon['coupon_picture']);?>" width="150" />
						 	</a>
						 	</div>
						 
						 	<h5>
						 		<a href="<?php echo edp_href_link(PAGENAME_COUPON_INFO, 'couponID='.$coupon['coupon_id']);?>">
						 		<?php echo $coupon['coupon_name'];?>
						 		</a>
						 	</h5>
<?php
							$types=explode(",",$coupon['coupon_type']);
							if(in_array("1", $types))
							{
								echo '<p>有效期：'.EdpSubStr($coupon['coupon_start_date'],0,10).'至'.EdpSubStr($coupon['coupon_end_date'],0,10).'</p>';
							}
							else
							{
								echo '<p>有效期：不限期</p>';
							}
							if(in_array("2", $types))
							{
								echo '<p>剩余数目：'.$coupon['coupon_total_num'].'</p>';
							}
							else
							{
								echo '<p>有效期：不限量</p>';
							}
?>
              				<p>交易价格：<?php echo $coupon['coupon_per_price'];?>个E币 </p>
            			</div>
<?php
						if($printN % 3 === 0)
						{
							echo '</div>';
						}
						$printN++;
					}
					if( $printN % 3 !== 1 )
					{
						echo '</div>';
					}
				} 	
				echo $pageObj->getBar(); 
				echo '</div>';
?>

        	<div class="btm"></div>
        </div>
    </div>
    
    <div id="sidebar_right">
	 	<div class="pub_coupon">
			<h3>我是商家</h3>
			<a href="<?php echo edp_href_link(PAGENAME_HELP, 'subpage=501');?>">
				<img src="<?php echo IMAGE_DIR ?>publishcoupon.png"/>
			</a>
		</div>
    	
      	<div class="column bdbottom2" >
     		<div class="btna solidbottom">
     			<h4>热门礼品</h4>
     		</div>
<?php
			if($hotgift)
			{
				$i = 1;
				foreach($hotgift as $gift)
				{
?>
      				<p><a <?php if( $i < 3 ) echo 'class="red"';?>  href="<?php echo edp_href_link(PAGENAME_GIFT_INFO, 'gid='.$gift['gift_id']);?>"><?php echo $gift['gift_name'];?></a></p>
<?php 	
      				$i++;
				}
			} 
?>
      </div>
      
      <div class="column bdbottom2" >
      		<div class=" solidbottom">
       			 <h4>最新兑换</h4>
       		</div>
<?php 		
			if($recenthistories) 
			{
       			foreach( $recenthistories as $history )
       			{
       	
?>
			      <p><a href="<?php echo edp_href_link(PAGENAME_USER_INFO, 'uid='.$history['user_id']);?>"><?php echo $history['nick']?></a>
			      <span class="blak">兑换了</span>
<?php
				  if($history['coupon_status']==1)
				  { 
?>
			      <a href="<?php echo edp_href_link(PAGENAME_COUPON_INFO, 'couponID='.$history['coupon_id']);?>">
<?php
				  } 
				  if(EdpStrLen($history['coupon_name'])>10)
				  		echo EdpSubStr($history['coupon_name'],0,10).'...';
				  else
				  		echo $history['coupon_name'];
				  if($history['coupon_status']==1)
				  { 
?>
				  </a>
<?php
				  } 
?>				    。
				  <span class="grey"><?php echo $history['timediff'];?>
				  </span></p>
<?php 
       			}
   			}
?>
	</div>
	
</div>
